package com.xwaiy.xwaiyrpc.fault.tolerant;

import com.xwaiy.xwaiyrpc.exception.RpcException;
import com.xwaiy.xwaiyrpc.exception.enums.ErrorCode;
import com.xwaiy.xwaiyrpc.model.RpcResponse;

import java.util.Map;

/**
 * 快速失败容错策略
 * @Author Xwaiy
 * @Date 2025/9/3 16:43
 **/
public class FailFastTolerantStrategy implements TolerantStrategy{

    @Override
    public RpcResponse doTolerant(Map<String, Object> context, Exception e) {
        throw new RpcException(ErrorCode.CONSUMER_INVOCATION_FAILED, "服务调用失败，请稍后重试", e);
    }
}
